Skip to content

feat(queue): connection-only GH event hand-off to chittyagent-dispatch [INERT]#252

Open
chitcommit wants to merge 2 commits into
mainfrom
feat/dispatch-handoff-seam
Open

feat(queue): connection-only GH event hand-off to chittyagent-dispatch [INERT]#252
chitcommit wants to merge 2 commits into
mainfrom
feat/dispatch-handoff-seam

Conversation

@chitcommit

Copy link
Copy Markdown
Contributor

Layer 1 — ChittyConnect: connection-only hand-off to chittyagent-dispatch

Part of the GitHub-event -> dispatch -> {gh_maintainer, linear_sync} fan-out wiring. This is the CONNECTION layer. ChittyConnect owns the GitHub App, HMAC verify, App token, and webhook receipt — and nothing else. It only hands off the normalized event to the routing layer.

What changed

  • src/handlers/queue.js, processEvent: at the existing MCP bus dispatch deferred to v3 seam (right after normalizeGitHubEvent), added a call to a new forwardToDispatch(env, event, mcpEvent).
  • forwardToDispatch forwards the normalized event to chittyagent-dispatch for the PR-shaped event types only: pull_request, pull_request_review, pull_request_review_thread, check_suite, check_run (set DISPATCH_EVENT_TYPES).
  • Transport: prefers the AGENT_DISPATCH service binding if present; else fetch(${DISPATCH_URL || 'https://dispatch.chitty.cc'}/dispatch/github`)`. Mirrors webhook-router.js header style (X-Webhook-Source: github, X-Webhook-Timestamp, X-Forwarded-By, and X-Webhook-Secret from INTERNAL_WEBHOOK_SECRET when set).
  • Fail-safe: the webhook is already fast-acked, so the hand-off never throws — it logs and continues. No merge logic, no Linear logic added here.
  • webhook-router.js AGENTS map left as github: null (GH is handled via this queue hand-off) — read for house style only, unchanged.

Deploy prerequisites (NOT set here — no fabricated values)

  • AGENT_DISPATCH service binding to chittyagent-dispatch or DISPATCH_URL var (default https://dispatch.chitty.cc).
  • Optional INTERNAL_WEBHOOK_SECRET (already an existing var; included when present).

Inert until wired

Until AGENT_DISPATCH/DISPATCH_URL resolves to a deployed dispatcher with the fan-out route, the hand-off is a no-op-on-failure (logs + continues). Nothing is deployed by this PR.

Validation

  • node --check src/handlers/queue.js — pass.

Follow-up (NOT this PR)

  • The gh-merge executor (acts under the GitHub App identity).
  • The Linear write executor.

Separation-of-concerns note

The one routing-ish decision in this connection layer is DISPATCH_EVENT_TYPES (which event types to forward). Defensible — the operator explicitly scoped Layer 1 to these five — but flagged honestly as the place SoC was closest to the line.

🤖 Generated with Claude Code

…patch

At the 'MCP bus dispatch deferred to v3' seam in processEvent, forward the
normalized event to the routing layer (chittyagent-dispatch) for the PR-shaped
event types: pull_request, pull_request_review, pull_request_review_thread,
check_suite, check_run.

CONNECTION layer only — no maintainer or Linear logic here. ChittyConnect owns
the GitHub App, HMAC verify, App token, and webhook receipt; it only hands off.
Reaches dispatch via the AGENT_DISPATCH service binding if present, else fetches
DISPATCH_URL (default https://dispatch.chitty.cc) using the existing
X-Webhook-* header style (incl. INTERNAL_WEBHOOK_SECRET when set). Fail-safe:
the webhook is already fast-acked, so the hand-off never throws — it logs and
continues. Inert until the AGENT_DISPATCH binding or DISPATCH_URL is configured.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
chittyconnect 6244511 Jun 16 2026, 04:46 PM

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@chitcommit, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 51 minutes. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 12b30f39-1260-4dc9-97ea-8af179447ffd

📥 Commits

Reviewing files that changed from the base of the PR and between c27eab2 and 6244511.

📒 Files selected for processing (1)
  • src/handlers/queue.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dispatch-handoff-seam

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chitcommit chitcommit marked this pull request as ready for review June 15, 2026 05:08
Copilot AI review requested due to automatic review settings June 15, 2026 05:08
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a connection-layer “hand-off” from the GitHub event queue consumer to chittyagent-dispatch, forwarding only a scoped set of PR-lifecycle GitHub event types while keeping existing v1 automations intact.

Changes:

  • Calls forwardToDispatch(env, event, mcpEvent) immediately after normalizeGitHubEvent() in processEvent.
  • Introduces DISPATCH_EVENT_TYPES allowlist for which GitHub events are forwarded.
  • Implements forwardToDispatch() to POST the normalized MCP event to dispatch via AGENT_DISPATCH binding when available, otherwise via DISPATCH_URL (defaulting to https://dispatch.chitty.cc), and logs outcomes without throwing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/handlers/queue.js
Comment thread src/handlers/queue.js Outdated
Comment thread src/handlers/queue.js Outdated
…dispatch hand-off

Address Copilot review on PR #252:
- add AbortSignal.timeout(5s) to both binding and fetch dispatch calls so a
  hung dispatch can't stall the queue consumer and back up v1 automations
- only forward X-Webhook-Secret to trusted hosts (*.chitty.cc / localhost)
  on the DISPATCH_URL fallback path, so a misconfigured URL can't leak the
  shared internal secret; binding path stays trusted
- compute transport label from the same predicate as the request branch so
  the log can't claim "binding" while actually using the fetch fallback

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants